/*
 * @Author: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @Date: 2022-10-23 21:11:22
 * @LastEditors: 郭招娣 10615594+guo-zhaodi@user.noreply.gitee.com
 * @LastEditTime: 2022-10-27 13:46:02
 * @FilePath: \宏烨找房\user\demo\src\page\buyHouse\index.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import React ,{ useEffect , useState} from 'react'
import { ArrowLeft, Ellipsis } from '@react-vant/icons';
import { useNavigate } from 'react-router-dom'

import './index.css'
 const MapHouse=()=> {
   const navigate = useNavigate()
   // 返回登录页面
   useEffect(() => {
     var map = new window.BMapGL.Map("container");          // 创建地图实例 
     var point = new window.BMapGL.Point(116.404, 39.915);  // 创建点坐标 
     map.centerAndZoom(point, 15);
     map.enableScrollWheelZoom(true);//开启鼠标滚轮缩放

     function myFun(result) {
       var cityName = result.name;
       map.setCenter(cityName);
      //  alert("当前定位城市:" + cityName);
       // console.log(cityName)
     }
     var myCity = new window.BMapGL.LocalCity();
     myCity.get(myFun);
   })
   const back = () => {
     navigate('/layout/home')
   }
  return (
    <div className='box'>
      <img src={require('../../img/2.png')} />
      <div className='top'>
        <ArrowLeft onClick={() => back()} />
        <b>地图找房</b>
        <Ellipsis />
      </div>

      <div className='myMap'>
        <div id="container" style={{ height: "100vh" }}></div>
      </div>

      
    </div>
  )
}
export default MapHouse;


